from .. import Modifications

class Modification():
	def __init__(self, name):
		self._name = name
		self._mmass = Modifications.getfloat(name, 'mmass')
		self._amass = Modifications.getfloat(name, 'amass')
		self._residues = Modifications.get(name, 'residues').split(',')
		self._modtype = Modifications.get(name, 'modtype')

		if self._residues[0] == '*':
			self._residues = ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'I', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y']
	def name(self):
		return self._name
	def mmass(self):
		return self._mmass
	def amass(self):
		return self._amass
	def residues(self):
		return self._residues
	def modtype(self):
		return self._modtype
		

class XLinker(Modification):
	def __init__(self, name):
		Modification.__init__(self, name)
		try:
			self._connections = Modifications.get(name, 'links').split(',')
		except:
			self._connections = []
	def connections(self):
		return self._connections
	def connectsWith(self, aa):
		if aa in self._connections:	
			return True
		return False